﻿
Imports System.Data.SqlClient
Imports System.Data
Imports Microsoft.ApplicationBlocks.Data

Partial Class Admin_Default2
    Inherits System.Web.UI.Page
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not Page.IsPostBack Then
            'Get the list of quesitons
            Dim reader As SqlDataReader = SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("connectionString"), _
        CommandType.StoredProcedure, "dq_GetAllQuestions")

            dgQuestions.DataSource = reader
            dgQuestions.DataBind()

            reader.Close()


            'Get the list of customer types
            reader = SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("connectionString"), _
        CommandType.StoredProcedure, "dq_GetAllHotDeals")

            dgCustomerTypes.DataSource = reader
            dgCustomerTypes.DataBind()

            reader.Close()


            'Get the list of customers
            reader = SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("connectionString"), _
                    CommandType.StoredProcedure, "dq_GetAllCustomers")

            dgCustomers.DataSource = reader
            dgCustomers.DataBind()

            reader.Close()
        End If
    End Sub

    Public Function GetQuestionsForHotDeal(ByVal hotDealId As Integer) As DataTable
        Return SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings("connectionString"), _
                CommandType.StoredProcedure, "dq_GetDynamicQuestionsForHotDeal", _
                New SqlParameter("@HotDealID", hotDealId)).Tables(0)
    End Function

End Class
